package com.kris;

import java.text.ParseException;
import java.util.Date;

/**
 * 一个员工一天的工作时间
 *
 * @author zhangqunshi
 */
class EmployeeWorkTime implements Comparable {

    String name;
    Date workDate;
    Date beginTime;
    Date endTime;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getWorkDate() {
        return workDate;
    }

    public void setWorkDate(Date workDate) throws ParseException {
        if (workDate != null) {
            this.workDate = DateUtil.onlyGetDate(workDate);
        }
    }

    public Date getBeginTime() {
        return beginTime;
    }

    public void setBeginTime(Date beginTime) {
        this.beginTime = beginTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    @Override
    public int compareTo(Object o) {
        if (o != null && beginTime != null) {
            EmployeeWorkTime other = (EmployeeWorkTime) o;
            if (other.beginTime.after(this.beginTime)) {
                return 1;
            }
        }
        return -1;
    }

}
